from django import forms


class UserForm(forms.Form):
    username = forms.CharField(
        label='用户名',
        min_length=2,
        max_length=10,
        error_messages={
            'min_length': '用户名长度小于2',
            'max_length': '用户名长度大于10'
        }
    )
    password = forms.CharField(
        label='密码',
        min_length=6,
        max_length=20,
        error_messages={
            'min_length': '密码长度小于6',
            'max_length': '密码长度大于20'
        },
        widget=forms.PasswordInput
    )
